package one.one.twentyEight;

import java.util.*;

public class RemoveDuplicates {

	static int bis(Integer[] a, Integer k, int b, int e) {
		if (b > e)
			return -1;
		int mid = b + (e - b) / 2;
		if (k < a[mid]) {
			return bis(a, k, b, mid-1);
		} else if (k > a[mid]) {
			return bis(a, k, mid + 1, e);
		} else {
			return mid;
		}

	}
	/*
	public static void main(String[] args) throws Exception {
		Integer[] a= {0,1,2,3,4};
		System.out.println(bis(a,0,0,0));
	}
	*/
	
	public static void main(String[] args) throws Exception {
		List<Integer> l = new ArrayList<Integer>();
		Scanner scanner = new Scanner(System.in);
		String s = scanner.nextLine();
		while (!s.equals("end")) {
			l.add(Integer.parseInt(s));
			s = scanner.nextLine();
		}
		scanner.close();
		Integer[] a = new Integer[l.size()];
		a = l.toArray(a);
		System.out.println(Arrays.toString(a));

		List<Integer> r = new ArrayList<Integer>();
		//r.add(a[0]);
		for (int i = 0; i < a.length; i++) {
			if (bis(a, a[i], 0, i - 1) == -1) {
				r.add(a[i]);
			}
		}
		System.out.println(r);
	}
	
}
